<?php
include_once "controle/config.php";
include_once "controle/db.php";
include_once "controle/valida.php";

header("Content-Type:text/javascript; charset=utf-8");

if(valida::nome($_POST["id"])){
    $sql = "SELECT count(*) FROM empresa WHERE identificacao = '".$_POST["id"]."'";
    $db = new db(config::$driver);
    $con = $db->conecta();
    $res = $db->query($sql, $con);
    $db->close($con);

    $empresa = $db->fetch_array($res);
    echo $empresa[0];
}else{
    echo 0;
}